home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 7 / Amiga Format AFCD07 (Dec 1996, Issue 91).iso / serious / shareware / programming / gamesmaster / includes / games / games.i < prev    next >
Encoding:
Text File  |  1996-09-13  |  13.1 KB  |  486 lines

  1. **
  2. **    $VER: games.i 0.3 (08.09.96)
  3. **    Includes Release xx.xx
  4. **
  5. **    (C) Copyright 1996 DreamWorld Productions.
  6. **        All Rights Reserved
  7. **
  8.  
  9.     IFND    EXEC_TYPES_I
  10.     include 'exec/types.i'
  11.     ENDC
  12.  
  13.     IFND    GMS_SOUND_I
  14.     include 'games/sound.i'
  15.     ENDC
  16.  
  17. FILTER_OFF =    0
  18. FILTER_ON =    1
  19. OFF =    0
  20. ON =    1
  21.  
  22. LISTSTART =    "LIST"         ;Used to indicate a list start.
  23.  
  24. ENDLIST =    0              ;Either one of these will terminate
  25. LISTEND =    0              ;a list.
  26.  
  27. * --- Universal JoyBits returned from Read_JoyStick, Sega, JoyPad, etc...
  28.  
  29. JT_SWITCH =    0
  30. JT_ZBXY =    1
  31.  
  32. JS_LEFT    =    0              ;X axis
  33. JS_RIGHT =    1
  34. JS_UP =        2              ;Y axis
  35. JS_DOWN    =    3
  36. JS_ZIN =    4              ;Z axis!  Reserved for later...
  37. JS_ZOUT =    5
  38. JS_FIRE1 =    6              ;Standard Fire Button (1).
  39. JS_FIRE2 =    7              ;Standard Fire Button (2).
  40. JS_FIRE3 =    8
  41.  
  42. JS_RED =    6              ;CD32 Fire button (1).
  43. JS_BLUE =    7              ;CD32 Fire button (2).
  44. JS_PLAY =    8              ;Other CD32 buttons here.
  45. JS_RWD =    9
  46. JS_FFW =    10
  47. JS_GREEN =    11
  48. JS_YELLOW =    12
  49.  
  50. * --- Bits for the ZBXY style return type (analogue joysticks)           
  51.  
  52. JB_FIRE1 =    16
  53. JB_FIRE2 =    17
  54. JB_FIRE3 =    18
  55.  
  56. MB_LMB    =    16
  57. MB_RMB    =    17
  58. MB_MMB    =    18
  59.  
  60. * --- Joyport names for calling Read_JoyStick/Mouse/JoyPad...()
  61.  
  62. JPORT1    =    0*2
  63. JPORT2    =    1*2
  64. JPORT3    =    2*2            ;Works for Read_JoyStick() only.
  65. JPORT4    =    3*2            ;Works for Read_JoyStick() only.
  66.  
  67. * --- Raster/Copper commands for RasterLists.
  68. *
  69. * Examples of how to use these commands/macros in a rasterlist:
  70. *
  71. * COL12      <ColourNumber>,<$0RGB>
  72. * COL24      <ColourNumber>,<$00RRGGBB>
  73. * COL12LIST  <StartLine>,<Skip>,<Colour>,<ColourList>
  74. * COL24LIST  <StartLine>,<SKip>,<Colour>,<ColourList>
  75. * SPRITE     <SpriteStruct>
  76. * SCROLL     <Fields>,<PixelOffset 0-16>,<PixelQuarterOffset 1-4>
  77. * FLOOD      
  78. * REPOINT    <BitplanePtr>
  79. * MIRROR     
  80. * NEWPALETTE <ColStart>,<AmtCols>,<Palette>
  81. * WAITLINE   <Line>
  82. * RASTEND
  83. *
  84. * Warn: With colour related commands you must use the same amount of colour
  85. * bits as specified in your GameScreen structure (COL12BIT or COL24BIT)
  86.  
  87. COL12Len =    12             ;COL12,Colour,RGB
  88. COL24Len =    16             ;COL24,Colour,RRGGBB
  89. COL12LISTLen =    16             ;COL12LIST,Line,Skip,Colour,RGB
  90. COL24LISTLen =    16             ;COL24LIST,Line,Skip,Colour,RRGGBB
  91. SPRITELen =    12             ;SPRITE,SpriteStruct
  92. SCROLLLen =    8              ;SCROLL,Offset
  93. FSCROLLLen =    16             ;FSCROLL,Offset
  94. FLOODLen =    8              ;FLOOD
  95. REPOINTLen =    12             ;REPOINT,BitPtr
  96. MIRRORLen =    8              ;MIRROR
  97. NEWPALETTELen = 20             ;NEWPALETTE,ColStart,AmtCols,Palette
  98. WAITLINELen =    8              ;WAITLINE,Line
  99.  
  100. COL12    MACRO   ;<ColourNumber>,<$RGB>
  101.     dc.w    00,\1,\2,0
  102.     dc.l    0
  103.     ENDM
  104.  
  105. COL24    MACRO   ;<ColourNumber>,<$RRGGBB>
  106.     dc.w    02,0
  107.     dc.l    \1
  108.     dc.l    \2
  109.     dc.l    0
  110.     ENDM
  111.  
  112. COL12LIST MACRO    ;<Line> <Skip> <Colour> <ColourList>
  113.     dc.w    04,\1,\2,\3
  114.     dc.l    \4
  115.     dc.l    0
  116.     ENDM
  117.  
  118. COL24LIST MACRO    ;<Line> <Skip> <Colour> <ColourList>
  119.     dc.w    06,\1,\2,\3
  120.     dc.l    \4
  121.     dc.l    0
  122.     ENDM
  123.  
  124. SPRITE    MACRO   ;<SpriteStruct>
  125.     dc.w    08,0
  126.     dc.l    \1
  127.     dc.l    0
  128.     ENDM
  129.  
  130. SCROLL    MACRO   ;<Fields>,<PixelOffset (0..16)>
  131.     dc.w    10,\1,\2,\3
  132.     dc.l    0
  133.     ENDM
  134.  
  135. FSCROLL    MACRO   ;<Fields>,<PixelOffset (0..16)>,<(0..4)>
  136.     dc.w    12,\1,\2,\3,\4,0
  137.     dc.l    0
  138.     ENDM
  139.  
  140. FLOOD    MACRO    ;<>
  141.     dc.w    14,0
  142.     dc.l    0
  143.     ENDM
  144.  
  145. REPOINT    MACRO   ;<BitplanePtr>
  146.     dc.w    16,0
  147.     dc.l    \2
  148.     dc.l    0
  149.     ENDM
  150.  
  151. MIRROR    MACRO    ;<>
  152.     dc.w    18,0
  153.     dc.l    0
  154.     ENDM
  155.  
  156. NEWPALETTE MACRO ;<ColStart>,<AmtCols>,<Palette>
  157.     dc.w    20,0
  158.     dc.l    \1
  159.     dc.l    \2
  160.     dc.l    \3
  161.     dc.l    0
  162.     ENDM
  163.  
  164. WAITLINE MACRO    ;<Line>
  165.     dc.w    22,\1
  166.     dc.l    0
  167.     ENDM
  168.  
  169. RASTEND    MACRO
  170.     dc.l    -1
  171.     ENDM
  172.  
  173. * --- GPI ID numbers.
  174.  
  175. GPI_SCREENS =    0
  176. GPI_BLITTER =    4
  177. GPI_SOUND =    8
  178. GPI_NETWORK =    12
  179. GPI_VECTORS =    16
  180. GPI_DEBUG =    20
  181. GPI_ANIM =    24
  182. GPI_REKO =    28
  183. GPI_TEXT =    32
  184.  
  185. * --- Standard screen structure.
  186.  
  187.    STRUCTURE    GameScreen,0      ;A GameScreen structure
  188.     ULONG    SS_VERSION        ;Vesion - "GSV1"
  189.     APTR    SS_Stats          ;Reserved.
  190.     APTR    SS_MemPtr1        ;Ptr to screen 1
  191.     APTR    SS_MemPtr2        ;Ptr to screen 2 (doubled buffer)
  192.     APTR    SS_MemPtr3        ;Ptr to screen 3 (tripled buffer)
  193.     APTR    SS_ScreenLink     ;Ptr to a linked screen.
  194.     APTR    SS_Palette        ;Ptr to the screen palette.
  195.     APTR    SS_RasterList     ;Ptr to a raster list (or not).
  196.     ULONG    SS_AmtColours     ;The amount of colours on screen.
  197.     UWORD    SS_ScrWidth       ;The width of the visible screen window.
  198.     UWORD    SS_ScrHeight      ;The height of the visible screen window.
  199.     UWORD    SS_PicWidth       ;The width of the complete screen/picture.
  200.     UWORD    SS_PicHeight      ;The height of the complete screen/picture.
  201.     UWORD    SS_Planes         ;The amount of planes in the screen.
  202.     WORD    SS_ScrXOffset     ;Hardware co-ordinate for TOS.
  203.     WORD    SS_ScrYOffset     ;Hardware co-ordinate for LOS.
  204.     WORD    SS_PicXOffset     ;Offset of the horizontal axis.
  205.     WORD    SS_PicYOffset     ;Offset of the vertical axis.
  206.     ULONG    SS_ScrAttrib      ;Special Attributes are?
  207.     UWORD    SS_ScrMode        ;What screen mode is it?
  208.     UBYTE    SS_ScrType        ;Interleaved/Planar/Chunky?
  209.     UBYTE    SS_Displayed      ;Reserved.
  210.     LABEL    GSV1_SIZEOF
  211.  
  212. * --- Screen types (flags for SS_ScrType).
  213.  
  214. INTERLEAVED =    0
  215. PLANAR =    1
  216. CHUNKY =    2
  217.  
  218. * --- Screen attributes (flags and bits for SS_ScrAttrib).
  219.  
  220. DBLBUFFER =    $00000001     ;For double buffering.
  221. TPLBUFFER =    $00000002     ;Triple buffering!!
  222. PLAYFIELD =    $00000004     ;Set if it's part of a playfield.
  223. HSCROLL =    $00000008     ;Gotta set this to do scrolling.
  224. VSCROLL =    $00000010     ;For vertical scrolling.
  225. SPRITES =    $00000020     ;Set this if you want sprites.
  226. HBUFFER =    $00000040     ;Create a scroll buffer for up to 100 screens.
  227. ; =        $00000080
  228. BLKBDR =    $00000100     ;Gives a blackborder on AGA machines.
  229. NOSPRBDR =    $00000200     ;For putting sprites in the border.
  230.  
  231. B_DBLBUFFER =    0
  232. B_TPLBUFFER =    1
  233. B_PLAYFIELD =    2
  234. B_HSCROLL =    3
  235. B_VSCROLL =    4
  236. B_SPRITES =    5
  237. B_HBUFFER =    6
  238. B_BLKBDR =    8
  239. B_BDRSPRITES =    9
  240.  
  241. * --- Screen modes (flags for SS_ScrMode).
  242.  
  243. LORES =        $0000         ;Low resolution (default).
  244. HIRES =        $0001         ;High resolution.
  245. SHIRES =    $0002         ;Super-High resolution.
  246. INTERLACED =    $0004         ;Interlaced.
  247. ; =        $0008         ;Reserved.
  248. EXTRAHB =    $0010         ;Set for extra half-brite.
  249. NTSC =        $0020         ;Set if you wrote this game in NTSC.
  250. HAM =        $0040         ;For HAM mode.
  251. COL24BIT =    $0080         ;24 Bit colours (otherwise it's 12Bits).
  252.  
  253. B_HIRES =    0
  254. B_SHIRES =    1
  255. B_INTERLACED =    2
  256. B_EXTRAHB =    4
  257. B_NTSC =    5
  258. B_HAM =        6
  259. B_COL24BIT =    7
  260.  
  261. * --- Screen Buffer names, these are asked for in the blitter functions.
  262.  
  263. BUFFER1 = SS_MemPtr1
  264. BUFFER2 = SS_MemPtr2
  265. BUFFER3 = SS_MemPtr3
  266.  
  267. * --- Universal errorcodes returned by certain functions.
  268.  
  269. ERR_OK    =  0            ;Function went OK.
  270. ERR_NOMEM =  1            ;Not enough memory available.
  271. ERR_NOPTR =  2            ;Relevant address pointer not present.
  272. ERR_INUSE =  3            ;Previous allocations have not been freed.
  273. ERR_STRUCT = 4            ;Structure version not supported/not found.
  274. ERR_FAILED = 5            ;General failure.
  275. ERR_FILE =   6            ;File error, eg file not found, disk full etc.
  276.  
  277. * --- Sprite structure
  278.  
  279.    STRUCTURE    Sprite,0
  280.     ULONG    SPR_VERSION       ;Structure version "SPV1".
  281.     APTR    SPR_Stats         ;Reserved.
  282.     UWORD    SPR_Number        ;Sprite bank number.
  283.     APTR    SPR_Data          ;Pointer to Sprite graphic.
  284.     WORD    SPR_XPos          ;X position (screen relative).
  285.     WORD    SPR_YPos          ;Y position (screen relative).
  286.     UWORD    SPR_Frame         ;Current frame number.
  287.     UWORD    SPR_Width         ;Width in pixels.
  288.     UWORD    SPR_Height        ;Height in pixels.
  289.     UWORD    SPR_AmtColours    ;4/16
  290.     UWORD    SPR_ColStart      ;000/016/032/064/096/128/160/192/224
  291.     UWORD    SPR_Planes        ;2/4
  292.     UWORD    SPR_Resolution    ;HIRES/LORES/SHIRES/XLONG
  293.     UWORD    SPR_FieldPriority ;Playfield priority.
  294.     ULONG    SPR_SpriteSize    ;Reserved.
  295.     ULONG    SPR_FrameSize     ;Reserved.
  296.     LABEL    SPV1_SIZEOF
  297.  
  298. * - Extra stuff for the SPR_Resolution field.
  299.  
  300. XLONG =    $0040                      ;Double the width (uses extra bank). 
  301.  
  302. * --- BOB structure
  303.  
  304.    STRUCTURE    BOB,0
  305.     ULONG    BOB_VERSION       ;Structure version - "BBV1"
  306.     APTR    BOB_Stats         ;Reserved.
  307.     UWORD    BOB_Frame         ;Current frame.
  308.     APTR    BOB_FrameList     ;Pointer to frame list.
  309.     WORD    BOB_XPos          ;X position.
  310.     WORD    BOB_YPos          ;Y position.
  311.     UWORD    BOB_Height        ;Height
  312.     UWORD    BOB_Width         ;Width in BYTES
  313.     UWORD    BOB_DestBuffer    ;
  314.     UWORD    BOB_Minterm
  315.     WORD    BOB_ClipLeft      ;"Clip Area" border restrictions.
  316.     WORD    BOB_ClipTop
  317.     WORD    BOB_ClipRight
  318.     WORD    BOB_ClipBottom
  319.     UWORD    BOB_Attrib        ;Mask/Chunky/Planar/Interleaved
  320.     UWORD    BOB_Planes
  321.     UWORD    BOB_SetPlanes     ;Planes to blit - planar only.
  322.     UWORD    BOB_Method
  323.     UWORD    BOB_BackGrndInfo  ;Is a background stored?
  324.     APTR    BOB_BackGrndPtr   ;Where is the background stored?
  325.     LABEL    BOB_SIZEOF
  326.  
  327. * --- Blit Direct structure.
  328.  
  329.    STRUCTURE    BlitDirect,0
  330.     ULONG    BD_VERSION       ;Structure version - "BBV1"
  331.     APTR    BD_Source
  332.     APTR    BD_Mask
  333.     APTR    BD_Dest
  334.     UWORD    BD_DestMod
  335.     UWORD    BD_SrcMod
  336.     UWORD    BD_Width
  337.     UWORD    BD_Height
  338.     UWORD    BD_Minterm
  339.     UWORD    BD_Method
  340.     UWORD    BD_Planes
  341.     UWORD    BD_SetPlanes     ;Planes to blit - planar only.
  342.     UWORD    BD_Attrib        ;Mask/Chunky/Planar/Interleaved
  343.     LABEL    BD_SIZEOF
  344.  
  345. ;* --- BOB Drawing Methods
  346.  
  347.                     ;INTERLEAVED
  348. INTLV_NCNM = 00             ;No clip, no mask  Takes the shortest time
  349. INTLV_NCYM = 01             ;No clip, masked
  350. INTLV_YCNM = 02             ;Clip, no mask
  351. INTLV_YCYM = 03             ;Clip, masked      Takes the longest time
  352.  
  353.                     ;PLANAR
  354. PLNR_NCNM = 04                ;No clip, no mask  Takes the shortest time
  355. PLNR_NCYM = 05                ;No clip, masked
  356. PLNR_YCNM = 06                ;Clip, no mask
  357. PLNR_YCYM = 07                ;Clip, masked      Takes the longest time
  358.  
  359.                     ;CHUNKY
  360. CHNKY_NCNM = 08             ;No clip, no mask  Takes the shortest time
  361. CHNKY_NCYM = 09             ;No clip, masked
  362. CHNKY_YCNM = 10             ;Clip, no mask
  363. CHNKY_YCYM = 11                ;Clip, masked      Takes the longest time
  364.  
  365. * --- The picture structure for loading and depacking of pictures.
  366.  
  367.   STRUCTURE    Picture,0
  368.     ULONG    PIC_VERSION              ;"PCV1"
  369.     APTR    PIC_Stats                ;Reserved.
  370.     APTR    PIC_Data                 ;Source.
  371.     UWORD    PIC_Width                ;Picture Width
  372.     UWORD    PIC_Height               ;Picture Height
  373.     UWORD    PIC_Planes               ;Amount of planes
  374.     ULONG    PIC_AmtColours    ;Amount of colours.
  375.     APTR    PIC_Palette              ;Ptr to Palette.
  376.     UWORD    PIC_ScrMode    ;Intended screen mode for picture.
  377.     UWORD    PIC_Type                 ;Interleaved/Chunky/Planar
  378.     ULONG    PIC_Attrib               ;GETPALETTE/VIDEOMEM/
  379.     LABEL    PCV1_SIZEOF
  380.  
  381. * --- The Anim structure for loading and playing of animations.
  382.  
  383.    STRUCTURE    AnimStruct,00
  384.     ULONG    ANM_VERSION    ;"AMV1"
  385.     APTR    ANM_Stats    ;Reserved.
  386.     UWORD    ANM_Width    ;Anim width
  387.     UWORD    ANM_Height    ;Anim height
  388.     UWORD    ANM_Frame    ;Current frame/Frame to unpack.
  389.     UWORD    ANM_AmtFrames    ;The total amount of frames.
  390.     ULONG    ANM_AmtColours    ;The total amount of colours.
  391.     APTR    ANM_Palette    ;Pointer to the frame's palette.
  392.     UWORD    ANM_Planes    ;Amount of planes if planar.
  393.     ULONG    ANM_Attrib    ;Special flags.
  394.     UWORD    ANM_ScrMode    ;Expected screen mode for anim.
  395.     UBYTE    ANM_Type    ;Interleaved/Chunky/Planar
  396.     APTR    ANM_FileName    ;Where this anim comes from.
  397.     LABEL    AMV1_SIZEOF
  398.  
  399. * --- Picture and Anim attributes (flags for ANM_Attrib and PIC_Attrib)
  400.  
  401. GETPALETTE =    $00000001          ;Allocate the palette?
  402. MEM_VIDEO =    $00000002          ;Unpack to chipram only?
  403.  
  404. * --- Choose one of these when calling Set_Interrupt().
  405.  
  406. INTB_INTEN =    14             ;Master interrupt (enable only )
  407. INTB_EXTER =    13             ;External interrupt
  408. INTB_DSKSYNC =    12             ;Disk re-SYNChronized
  409. INTB_RBF =    11             ;serial port Receive Buffer Full
  410. INTB_AUD3 =    10             ;Audio channel 3 block finished
  411. INTB_AUD2 =    9              ;Audio channel 2 block finished
  412. INTB_AUD1 =    8              ;Audio channel 1 block finished
  413. INTB_AUD0 =    7              ;Audio channel 0 block finished
  414. INTB_BLIT =    6              ;Blitter finished
  415. INTB_VERTB =    5              ;start of Vertical Blank
  416. INTB_COPER =    4              ;Coprocessor
  417. INTB_PORTS =    3              ;I/O Ports and timers
  418. INTB_SOFTINT =    2              ;software interrupt rest
  419. INTB_DSKBLK =    1              ;Disk Block done
  420. INTB_TBE =    0              ;serial port Transmit Buffer Empty
  421.  
  422. * --- The KeyPress structure, used by Read_Key().
  423.  
  424.     STRUCTURE    KP,00
  425.     UWORD    KP_ID          ;GMS Identification - ignore.
  426.     UBYTE    KP_Key1        ;Newest Keypress
  427.     UBYTE    KP_Key2        ;...
  428.     UBYTE    KP_Key3        ;...
  429.     UBYTE    KP_Key4        ;Oldest Keypress
  430.     LABEL    KP_SIZEOF
  431.  
  432. * --- Special Keypresses that can be returned from Read_Key().  All other
  433. *     keys can be considered to be in ASCII format. 
  434.  
  435. K_SCS =        $80                   ;ScreenSwitch (LEFTAMIGA + M)
  436. K_DEL    =    $81
  437. K_HELP    =    $82
  438.  
  439. K_LSHIFT =    $83
  440. K_RSHIFT =    $84
  441. K_CAPS =    $85
  442. K_CTRL =    $86
  443. K_LALT =    $87
  444. K_RALT =    $88
  445. K_LAMIGA =    $89
  446. K_RAMIGA =    $8a
  447.  
  448. K_F1    =    $8b
  449. K_F2    =    $8c
  450. K_F3    =    $8d
  451. K_F4    =    $8e
  452. K_F5    =    $8f
  453. K_F6    =    $90
  454. K_F7    =    $91
  455. K_F8    =    $92
  456. K_F9    =    $93
  457. K_F10    =    $94
  458. K_F11    =    $95
  459. K_F12    =    $96
  460. K_F13    =    $97
  461. K_F14    =    $98
  462. K_F15    =    $99
  463. K_F16    =    $9a
  464. K_F17    =    $9b
  465. K_F18    =    $9c
  466. K_F19    =    $9d
  467. K_F20    =    $9e
  468.  
  469. C_UP    =    $9f
  470. C_DOWN    =    $a0
  471. C_RIGHT    =    $a1
  472. C_LEFT    =    $a2
  473.  
  474. K_SRIGHT =    $a3                   ;Special key on right.
  475. K_SLEFT =    $a4                   ;Special key on left.
  476.  
  477. * --- Special keys that are recognised under ASCII (here for convenience).
  478.  
  479. K_BAKSPC =    08
  480. K_TAB    =    09
  481. K_ENTER =    10
  482. K_RETURN =    10
  483. K_ESC    =    ""
  484.  
  485.  
  486.